<!DOCTYPE html>
<html>
	<head>
		<title></title>
	</head>
	<body>
		<input type="button" value="全选" id="selectAll"/>
		<input type="button" value="反选" id="selectInvert" />
		<input type="button" value="全不选" id="selectNotAll" />
		<div id="div1">
			<input type="checkbox"/>1<br/>
			<input type="checkbox"/>2<br/>
			<input type="checkbox"/>3<br/>
			<input type="checkbox"/>4<br/>
			<input type="checkbox"/>5<br/>
			<input type="checkbox"/>6<br/>
			<input type="checkbox"/>7<br/>
			<input type="checkbox"/>8<br/>
			<input type="checkbox"/>9<br/>
			<input type="checkbox"/>10<br/>
			<input type="checkbox"/>11<br/>
			<input type="checkbox"/>12<br/>
			<input type="checkbox"/>13<br/>
			<input type="checkbox"/>14<br/>
			<input type="checkbox"/>15<br/>
			<input type="checkbox"/>16<br/>
			<input type="checkbox"/>17<br/>
		</div>
	</body>
	<script>
		window.onload = function (){
			var obj_Select_All = document.getElementById("selectAll");
			var obj_Select_Invert = document.getElementById("selectInvert");
			var obj_Select_NotAll = document.getElementById("selectNotAll");
			var obj_CheckBoxs = document.getElementsByTagName("input");
			
			obj_Select_All.onclick = function(){
				for(var i=0;i<obj_CheckBoxs.length;i++){
					obj_CheckBoxs[i].checked=true;
				}
			}
			
			obj_Select_NotAll.onclick = function(){
				for(var i=0;i<obj_CheckBoxs.length;i++){
					obj_CheckBoxs[i].checked=false;
				}
			}
			
			obj_Select_Invert.onclick = function(){
				for(var i=0;i<obj_CheckBoxs.length;i++){
					if(obj_CheckBoxs[i].checked==true){
						obj_CheckBoxs[i].checked=false;
					}else{
						obj_CheckBoxs[i].checked=true;
					}
				}
			}
		}
	</script>
</html>